<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Happy dong
 * Created Time: 2019-06-29 11:30
 *
 * Version: 2.0
 */

namespace App\Modules\Order\Repositories;


use App\Models\OrderCommentReply;
use App\Modules\Order\Validators\OrderCommentReplyValidator;
use Flower\Core\Repository\Eloquent\BaseRepository;
use Flower\Core\Repository\Exceptions\ValidatorException;
use Illuminate\Support\MessageBag;

class OrderCommentReplyRepository extends BaseRepository
{
	public function model()
	{
		return OrderCommentReply::class;
	}

	public function validator()
	{
		return OrderCommentReplyValidator::class;
	}


	public function addReply($commentId,$userId,$content,$memberId=0){
		$data = [
			'comment_id' => $commentId,
			'user_id'    => $userId,
			'member_id'  => $memberId,
			'contents'    => $content,
			'type'       => empty($memberId) ? 2 : 1 ,
		];
		return $this->create($data);
	}

	/**
	 * 删除回复
	 * @param $requestData
	 * @return int
	 */
	public function del($requestData){
		return $this->delete($requestData['comment_reply_id']);
	}


}